import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getAbout } from '@/api/about'
export const useAboutStore = defineStore('about', () => {
  const loading = ref(false)
  const data = ref('')
  function setLoading(payload: boolean) {
    loading.value = payload
  }
  function setData(payload: string) {
    data.value = payload
  }
  async function fetchAbout() {
    if (data.value) {
      return
    }
    setLoading(true)
    const resp = await getAbout()

    setData(resp)
    setLoading(false)
  }
  return {
    loading,
    data,
    fetchAbout
  }
})
